#pragma once

#include <sstream>
#include <fstream>

const float screenWidth = 800;
const float screenHeight = 600;
const float INFINITY = 60000;

inline std::string itos(int i)
{
	std::stringstream s; 
	s << i;
	return s.str();
}

//convert an time to a string
inline std::string timeDisplay(float seconds)
{
	int sec = (int)seconds;
	if (seconds != sec){
		sec++;
	}
	int min = sec / 60;
	sec = sec % 60;
	std::string colon = ":";
	if (sec < 10)
	{
		colon = ":0";
	}
	return itos(min) + colon + itos(sec);
}

inline std::string getline(std::ifstream & iFile)
{
	char line[256];
	iFile.getline(line, 256);
	std::stringstream s; 
	s << line;
	return s.str();
}

inline bool isEqual(float v1, float v2)
{
	return abs(v2 - v1) < 0.0001f;
}

inline void renderColorbox(Zeni::Color color, float x, float y, float width, float height)
{
	Zeni::Vertex2f_Color v0(Zeni::Point2f(x, y), color);
	Zeni::Vertex2f_Color v1(Zeni::Point2f(x + width, y), color);
	Zeni::Vertex2f_Color v2(Zeni::Point2f(x + width, y + height), color);
	Zeni::Vertex2f_Color v3(Zeni::Point2f(x, y + height), color);
	Zeni::get_Video().render(Zeni::Quadrilateral<Zeni::Vertex2f_Color>(v0, v1, v2, v3));
}